/**
 * Launcher.java
 * 2011-11-20 上午11:40:17
 */
package xgenerator;

import javax.swing.JApplet;
import javax.swing.JOptionPane;
import javax.swing.UIManager;

import xgenerator.ui.swing.LogonFrame;
import xgenerator.ui.swing.SplashScreen;

/**
 * <p>
 * Title:类的中文名
 * </p>
 * <p>
 * Description:具体功能见各方法描述
 * </p>
 * <p>
 * Copyright:Copyright (c) 2011
 * </p>
 * 
 * @author <a href="mailto:lishushan@gmail.com">liss</a>
 * @version 1.0
 */
public class Launcher extends JApplet {
	
	private SplashScreen splashScreen;
	
	@Override
	public void init() {
		super.init();
		main(null);
	}

	public static void main(String[] args) {
		try {
			UIManager.setLookAndFeel(UIManager.getSystemLookAndFeelClassName());
//			UIManager.setLookAndFeel(UIManager.getCrossPlatformLookAndFeelClassName());
			
//			UIManager.setLookAndFeel("com.sun.java.swing.plaf.windows.WindowsLookAndFeel");  //Windows
//			UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.MotifLookAndFeel");  //(CDE/Motif)Solaris、SunOS
//			UIManager.setLookAndFeel("com.sun.java.swing.plaf.motif.GTKLookAndFeel");  //gnome
//			UIManager.setLookAndFeel("javax.swing.plaf.metal.MetalLookAndFeel");  //swing.crossplatformlaf
			
			Launcher.launchSplashScreen();
			Launcher.loadApplication();
		} catch (Exception e) {
			e.printStackTrace();
			Launcher.launchErrorScreen(e.getMessage());
		}
	}

	public static void launchSplashScreen() {
		new Thread() {//用于运行SplashScreen的线程   
            public void run(){
            	//new SplashScreen();
            }
		}.start();
	}
	
	public static void loadApplication() {
		new Thread() {//用于运行SplashScreen的线程   
            public void run(){
            	try {
        			//Thread.sleep(3000); //这儿决定SplashScreen显示时间长短.  对于实际应用程序,这儿对应程序的初始化工作
        			new LogonFrame();
        		} catch (Exception e) {
        		}
            }
		}.start();
	}

	public static void launchErrorScreen(String message) {
		JOptionPane.showMessageDialog(null, message, "提示", JOptionPane.ERROR_MESSAGE);
	}

}
